#include<stdio.h>
#include<stdlib.h>
#include "sdf.h"
int main(){
   void **pdh;
   pdh=(void **)malloc(20);  //给pdh分配空间
   int ret;
   ret = SDF_OpenDevice(pdh);  //返回handle的指针

   if(ret != SDF_OK)
   {
    printf("打开设备失败\n");
   }
   else
   {
    printf("打开设备成功！\n");
  }
   printf("查看设备信息\n");
   DEVICEINFO a;
   ret = SDF_GetDeviceInfo(*pdh,&a);
   if(ret !=SDF_OK)
           printf("查看设备信息失败！\n");
   else
           printf("查看设备信息成功！\n");
   printf("设备名字叫做%s\n",a.DeviceName);
   printf("设备版本号为%d\n",a.DeviceVersion);
   printf("想要获取的随机数长度为：\n");
   int n;
   scanf("%d",&n);
   char string[100];
   ret = SDF_GenerateRandom(*pdh,n,string);
   if(ret !=SDF_OK)
    printf("生成随机数失败！");
    else
     printf("生成的随机数为%s\n",string);
   ret = SDF_CloseDevice(*pdh);
   if(ret != SDF_OK)
   {
    printf("关闭不成功！\n");
   }
   else
   {
    printf("关闭成功！\n");
   }
}
